package main

import "fmt"

func accumlator() func(uint8) uint8 {
	var sum uint8
	return func(u uint8) uint8 {
		sum += u
		fmt.Printf("sum for 1 to %d is %d\n", u, sum)
		return sum
	}
}
func main() {
	f := accumlator()
	for i := 0; i < 10; i++ {
		f(uint8(i))
	}
}
